<?php
echo("<h2>".$article['Article']['title']."</h2>");
echo($article['Article']['content']);
?>
<?php
//debug_pre($article);
?>
<?php
$commentsCount = count($comments);
if($commentsCount > 0) {
    echo("<a name=\"comments\">&nbsp;</a><h3>Komentarze (".$commentsCount.")</h3>");

    foreach($comments as $comment) {
        echo("<p><strong>".$comment['User']['username'].": </strong>".$comment['ArticleComment']['content']."</p><hr />");
    }
}
?>
<h3>Skomentuj</h3>

<?php
if($authorized) {
    echo $this->Form->create('ArticleComment', array('url' => '/articles/save_comment'));
    echo $this->Form->hidden("article_id", array('value' => $article['Article']['id']));
    echo $this->Form->hidden("user_id", array('value' => $authorizedUser['id']));
    echo $this->Form->input("content", array('label' => false));

    echo $this->Form->end("Zapisz");
}
else echo("Musisz się <a href=\"/user/login\">zalogować</a>, aby dodawać komentarze.");
?>